import Router from "@koa/router";
import { getUsers, postUser } from "../controller/user.js";
import { getQuestions, postQuestion, updateQuestion, deleteQuestion, getSingleQuestion } from "../controller/question.js";
import { generateQuestions } from "../controller/ai.js";

const router = new Router({
  prefix: "/api",
});

// 用户相关路由
router.get("/users", getUsers);
router.post("/users", postUser);

// 题目相关路由
router.get("/questions/:id", getSingleQuestion);//注意顺序
router.get("/questions", getQuestions);
router.post("/questions", postQuestion);
router.patch("/questions/:id", updateQuestion);
router.delete("/questions", deleteQuestion);

// AI 生成题目路由
router.post("/generate-questions", generateQuestions);

export default router;
